Adjust saved positions of children when resizing a guffaw_gravity = TRUE
authorOwen Taylor <otaylor@redhat.com>
Fri, 5 Feb 1999 18:40:14 +0000 (18:40 +0000)
committerOwen Taylor <otaylor@src.gnome.org>
Fri, 5 Feb 1999 18:40:14 +0000 (18:40 +0000)
Fri Feb  5 13:23:50 1999  Owen Taylor  <otaylor@redhat.com>

* gdk/gdkwindow.c (gdk_window_move_resize): Adjust
saved positions of children when resizing a
guffaw_gravity = TRUE window.

* gtk/gtkdnd.c (gtk_drag_highlight): Rework the
 highlighting so that it is done in callbacks for
 draw and expose. This should solve problems with
         multiple highlights for the same GdkWindow.

* gtk/gtkdnd.c (gtk_drag_highlight): Fix bug where
the highlight was being drawn with an incorrect
width/height for !NO_WINDOW widgets.

ChangeLog
ChangeLog.pre-2-0
ChangeLog.pre-2-10
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gdk/gdkwindow.c
gdk/x11/gdkwindow-x11.c
gtk/gtkdnd.c

index c9b3147e7f26af9e2b5605c8e2a0c189dab980cb..ff2bf351dfa70a0e60d40fd27c45797cdac3cff8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,24 @@
+Fri Feb  5 13:23:50 1999  Owen Taylor  <otaylor@redhat.com>
+
+       * gdk/gdkwindow.c (gdk_window_move_resize): Adjust
+       saved positions of children when resizing a 
+       guffaw_gravity = TRUE window.
+
+       * gtk/gtkdnd.c (gtk_drag_highlight): Rework the
+        highlighting so that it is done in callbacks for
+        draw and expose. This should solve problems with
+         multiple highlights for the same GdkWindow.
+
+       * gtk/gtkdnd.c (gtk_drag_highlight): Fix bug where
+       the highlight was being drawn with an incorrect
+       width/height for !NO_WINDOW widgets.
+
+Tue Feb  2 11:06:02 1999  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkrange.c (gtk_range_style_set): Fixes
+        to account for the changed structure of the windows
+        of range widgets.
+
 1999-02-05  Owen Taylor  <otaylor@gtk.org>
 
        * gtk/gtk[hv]paned.c (gtk_[hv]paned_size_allocate): 
@@ -35,12 +56,6 @@ Tue Feb  2 12:39:42 1999  Owen Taylor  <otaylor@redhat.com>
         Make it consistent that info->cur_x/y do not include
         info->hot_x/y displacement.
 
-Tue Feb  2 11:06:02 1999  Owen Taylor  <otaylor@redhat.com>
-
-       * gtk/gtkrange.c (gtk_range_style_set): Fixes
-        to account for the changed structure of the windows
-        of range widgets.
-
 Tue Feb  2 08:59:16 GMT 1999 Tony Gale  <gale@gtk.org>
 
        * docs/gtk_tut.sgml: new sections on Layout and
index c9b3147e7f26af9e2b5605c8e2a0c189dab980cb..ff2bf351dfa70a0e60d40fd27c45797cdac3cff8 100644 (file)
@@ -1,3 +1,24 @@
+Fri Feb  5 13:23:50 1999  Owen Taylor  <otaylor@redhat.com>
+
+       * gdk/gdkwindow.c (gdk_window_move_resize): Adjust
+       saved positions of children when resizing a 
+       guffaw_gravity = TRUE window.
+
+       * gtk/gtkdnd.c (gtk_drag_highlight): Rework the
+        highlighting so that it is done in callbacks for
+        draw and expose. This should solve problems with
+         multiple highlights for the same GdkWindow.
+
+       * gtk/gtkdnd.c (gtk_drag_highlight): Fix bug where
+       the highlight was being drawn with an incorrect
+       width/height for !NO_WINDOW widgets.
+
+Tue Feb  2 11:06:02 1999  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkrange.c (gtk_range_style_set): Fixes
+        to account for the changed structure of the windows
+        of range widgets.
+
 1999-02-05  Owen Taylor  <otaylor@gtk.org>
 
        * gtk/gtk[hv]paned.c (gtk_[hv]paned_size_allocate): 
@@ -35,12 +56,6 @@ Tue Feb  2 12:39:42 1999  Owen Taylor  <otaylor@redhat.com>
         Make it consistent that info->cur_x/y do not include
         info->hot_x/y displacement.
 
-Tue Feb  2 11:06:02 1999  Owen Taylor  <otaylor@redhat.com>
-
-       * gtk/gtkrange.c (gtk_range_style_set): Fixes
-        to account for the changed structure of the windows
-        of range widgets.
-
 Tue Feb  2 08:59:16 GMT 1999 Tony Gale  <gale@gtk.org>
 
        * docs/gtk_tut.sgml: new sections on Layout and
index c9b3147e7f26af9e2b5605c8e2a0c189dab980cb..ff2bf351dfa70a0e60d40fd27c45797cdac3cff8 100644 (file)
@@ -1,3 +1,24 @@
+Fri Feb  5 13:23:50 1999  Owen Taylor  <otaylor@redhat.com>
+
+       * gdk/gdkwindow.c (gdk_window_move_resize): Adjust
+       saved positions of children when resizing a 
+       guffaw_gravity = TRUE window.
+
+       * gtk/gtkdnd.c (gtk_drag_highlight): Rework the
+        highlighting so that it is done in callbacks for
+        draw and expose. This should solve problems with
+         multiple highlights for the same GdkWindow.
+
+       * gtk/gtkdnd.c (gtk_drag_highlight): Fix bug where
+       the highlight was being drawn with an incorrect
+       width/height for !NO_WINDOW widgets.
+
+Tue Feb  2 11:06:02 1999  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkrange.c (gtk_range_style_set): Fixes
+        to account for the changed structure of the windows
+        of range widgets.
+
 1999-02-05  Owen Taylor  <otaylor@gtk.org>
 
        * gtk/gtk[hv]paned.c (gtk_[hv]paned_size_allocate): 
@@ -35,12 +56,6 @@ Tue Feb  2 12:39:42 1999  Owen Taylor  <otaylor@redhat.com>
         Make it consistent that info->cur_x/y do not include
         info->hot_x/y displacement.
 
-Tue Feb  2 11:06:02 1999  Owen Taylor  <otaylor@redhat.com>
-
-       * gtk/gtkrange.c (gtk_range_style_set): Fixes
-        to account for the changed structure of the windows
-        of range widgets.
-
 Tue Feb  2 08:59:16 GMT 1999 Tony Gale  <gale@gtk.org>
 
        * docs/gtk_tut.sgml: new sections on Layout and
index c9b3147e7f26af9e2b5605c8e2a0c189dab980cb..ff2bf351dfa70a0e60d40fd27c45797cdac3cff8 100644 (file)
@@ -1,3 +1,24 @@
+Fri Feb  5 13:23:50 1999  Owen Taylor  <otaylor@redhat.com>
+
+       * gdk/gdkwindow.c (gdk_window_move_resize): Adjust
+       saved positions of children when resizing a 
+       guffaw_gravity = TRUE window.
+
+       * gtk/gtkdnd.c (gtk_drag_highlight): Rework the
+        highlighting so that it is done in callbacks for
+        draw and expose. This should solve problems with
+         multiple highlights for the same GdkWindow.
+
+       * gtk/gtkdnd.c (gtk_drag_highlight): Fix bug where
+       the highlight was being drawn with an incorrect
+       width/height for !NO_WINDOW widgets.
+
+Tue Feb  2 11:06:02 1999  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkrange.c (gtk_range_style_set): Fixes
+        to account for the changed structure of the windows
+        of range widgets.
+
 1999-02-05  Owen Taylor  <otaylor@gtk.org>
 
        * gtk/gtk[hv]paned.c (gtk_[hv]paned_size_allocate): 
@@ -35,12 +56,6 @@ Tue Feb  2 12:39:42 1999  Owen Taylor  <otaylor@redhat.com>
         Make it consistent that info->cur_x/y do not include
         info->hot_x/y displacement.
 
-Tue Feb  2 11:06:02 1999  Owen Taylor  <otaylor@redhat.com>
-
-       * gtk/gtkrange.c (gtk_range_style_set): Fixes
-        to account for the changed structure of the windows
-        of range widgets.
-
 Tue Feb  2 08:59:16 GMT 1999 Tony Gale  <gale@gtk.org>
 
        * docs/gtk_tut.sgml: new sections on Layout and
index c9b3147e7f26af9e2b5605c8e2a0c189dab980cb..ff2bf351dfa70a0e60d40fd27c45797cdac3cff8 100644 (file)
@@ -1,3 +1,24 @@
+Fri Feb  5 13:23:50 1999  Owen Taylor  <otaylor@redhat.com>
+
+       * gdk/gdkwindow.c (gdk_window_move_resize): Adjust
+       saved positions of children when resizing a 
+       guffaw_gravity = TRUE window.
+
+       * gtk/gtkdnd.c (gtk_drag_highlight): Rework the
+        highlighting so that it is done in callbacks for
+        draw and expose. This should solve problems with
+         multiple highlights for the same GdkWindow.
+
+       * gtk/gtkdnd.c (gtk_drag_highlight): Fix bug where
+       the highlight was being drawn with an incorrect
+       width/height for !NO_WINDOW widgets.
+
+Tue Feb  2 11:06:02 1999  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkrange.c (gtk_range_style_set): Fixes
+        to account for the changed structure of the windows
+        of range widgets.
+
 1999-02-05  Owen Taylor  <otaylor@gtk.org>
 
        * gtk/gtk[hv]paned.c (gtk_[hv]paned_size_allocate): 
@@ -35,12 +56,6 @@ Tue Feb  2 12:39:42 1999  Owen Taylor  <otaylor@redhat.com>
         Make it consistent that info->cur_x/y do not include
         info->hot_x/y displacement.
 
-Tue Feb  2 11:06:02 1999  Owen Taylor  <otaylor@redhat.com>
-
-       * gtk/gtkrange.c (gtk_range_style_set): Fixes
-        to account for the changed structure of the windows
-        of range widgets.
-
 Tue Feb  2 08:59:16 GMT 1999 Tony Gale  <gale@gtk.org>
 
        * docs/gtk_tut.sgml: new sections on Layout and
index c9b3147e7f26af9e2b5605c8e2a0c189dab980cb..ff2bf351dfa70a0e60d40fd27c45797cdac3cff8 100644 (file)
@@ -1,3 +1,24 @@
+Fri Feb  5 13:23:50 1999  Owen Taylor  <otaylor@redhat.com>
+
+       * gdk/gdkwindow.c (gdk_window_move_resize): Adjust
+       saved positions of children when resizing a 
+       guffaw_gravity = TRUE window.
+
+       * gtk/gtkdnd.c (gtk_drag_highlight): Rework the
+        highlighting so that it is done in callbacks for
+        draw and expose. This should solve problems with
+         multiple highlights for the same GdkWindow.
+
+       * gtk/gtkdnd.c (gtk_drag_highlight): Fix bug where
+       the highlight was being drawn with an incorrect
+       width/height for !NO_WINDOW widgets.
+
+Tue Feb  2 11:06:02 1999  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkrange.c (gtk_range_style_set): Fixes
+        to account for the changed structure of the windows
+        of range widgets.
+
 1999-02-05  Owen Taylor  <otaylor@gtk.org>
 
        * gtk/gtk[hv]paned.c (gtk_[hv]paned_size_allocate): 
@@ -35,12 +56,6 @@ Tue Feb  2 12:39:42 1999  Owen Taylor  <otaylor@redhat.com>
         Make it consistent that info->cur_x/y do not include
         info->hot_x/y displacement.
 
-Tue Feb  2 11:06:02 1999  Owen Taylor  <otaylor@redhat.com>
-
-       * gtk/gtkrange.c (gtk_range_style_set): Fixes
-        to account for the changed structure of the windows
-        of range widgets.
-
 Tue Feb  2 08:59:16 GMT 1999 Tony Gale  <gale@gtk.org>
 
        * docs/gtk_tut.sgml: new sections on Layout and
index c9b3147e7f26af9e2b5605c8e2a0c189dab980cb..ff2bf351dfa70a0e60d40fd27c45797cdac3cff8 100644 (file)
@@ -1,3 +1,24 @@
+Fri Feb  5 13:23:50 1999  Owen Taylor  <otaylor@redhat.com>
+
+       * gdk/gdkwindow.c (gdk_window_move_resize): Adjust
+       saved positions of children when resizing a 
+       guffaw_gravity = TRUE window.
+
+       * gtk/gtkdnd.c (gtk_drag_highlight): Rework the
+        highlighting so that it is done in callbacks for
+        draw and expose. This should solve problems with
+         multiple highlights for the same GdkWindow.
+
+       * gtk/gtkdnd.c (gtk_drag_highlight): Fix bug where
+       the highlight was being drawn with an incorrect
+       width/height for !NO_WINDOW widgets.
+
+Tue Feb  2 11:06:02 1999  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtkrange.c (gtk_range_style_set): Fixes
+        to account for the changed structure of the windows
+        of range widgets.
+
 1999-02-05  Owen Taylor  <otaylor@gtk.org>
 
        * gtk/gtk[hv]paned.c (gtk_[hv]paned_size_allocate): 
@@ -35,12 +56,6 @@ Tue Feb  2 12:39:42 1999  Owen Taylor  <otaylor@redhat.com>
         Make it consistent that info->cur_x/y do not include
         info->hot_x/y displacement.
 
-Tue Feb  2 11:06:02 1999  Owen Taylor  <otaylor@redhat.com>
-
-       * gtk/gtkrange.c (gtk_range_style_set): Fixes
-        to account for the changed structure of the windows
-        of range widgets.
-
 Tue Feb  2 08:59:16 GMT 1999 Tony Gale  <gale@gtk.org>
 
        * docs/gtk_tut.sgml: new sections on Layout and
index c3fd22581775e8182cd9c6d6f0f851929df9c191..e6695e242afdbc1003cf26070e96a20680317132 100644 (file)
@@ -852,6 +852,20 @@ gdk_window_move_resize (GdkWindow *window,
     {
       XMoveResizeWindow (private->xdisplay, private->xwindow, x, y, width, height);
       
+      if (private->guffaw_gravity)
+       {
+         GList *tmp_list = private->children;
+         while (tmp_list)
+           {
+             GdkWindowPrivate *child_private = tmp_list->data;
+
+             child_private->x -= x - private->x;
+             child_private->y -= y - private->y;
+             
+             tmp_list = tmp_list->next;
+           }
+       }
+      
       if (private->window_type == GDK_WINDOW_CHILD)
        {
          private->x = x;
index c3fd22581775e8182cd9c6d6f0f851929df9c191..e6695e242afdbc1003cf26070e96a20680317132 100644 (file)
@@ -852,6 +852,20 @@ gdk_window_move_resize (GdkWindow *window,
     {
       XMoveResizeWindow (private->xdisplay, private->xwindow, x, y, width, height);
       
+      if (private->guffaw_gravity)
+       {
+         GList *tmp_list = private->children;
+         while (tmp_list)
+           {
+             GdkWindowPrivate *child_private = tmp_list->data;
+
+             child_private->x -= x - private->x;
+             child_private->y -= y - private->y;
+             
+             tmp_list = tmp_list->next;
+           }
+       }
+      
       if (private->window_type == GDK_WINDOW_CHILD)
        {
          private->x = x;
index 612f1fc26bb38456bb271ca12b192d1b1cd51139..6e4adfff6bb05acaf5d78ae39cc72518076b8de9 100644 (file)
@@ -155,6 +155,12 @@ static GdkCursor *   gtk_drag_get_cursor         (GdkDragAction action);
 static GtkWidget    *gtk_drag_get_ipc_widget     (void);
 static void          gtk_drag_release_ipc_widget (GtkWidget *widget);
 
+static void          gtk_drag_highlight_paint  (GtkWidget  *widget);
+static gboolean      gtk_drag_highlight_expose (GtkWidget      *widget,
+                                               GdkEventExpose *event,
+                                               gpointer        data);
+
+
 static GdkAtom   gtk_drag_dest_find_target    (GtkWidget          *widget,
                                               GtkDragDestSite    *site,
                                               GdkDragContext     *context);
@@ -650,43 +656,85 @@ gtk_drag_finish (GdkDragContext *context,
 }
 
 /*************************************************************
- * gtk_drag_highlight:
- *     Highlight the given widget in the default manner.
+ * gtk_drag_highlight_paint:
+ *     Paint a highlight indicating drag status onto the widget.
  *   arguments:
  *     widget:
  *   results:
  *************************************************************/
 
-void 
-gtk_drag_highlight (GtkWidget  *widget)
+static void 
+gtk_drag_highlight_paint (GtkWidget  *widget)
 {
-  gint x, y;
+  gint x, y, width, height;
 
   g_return_if_fail (widget != NULL);
 
-  if (GTK_WIDGET_NO_WINDOW (widget))
-    {
-      x = widget->allocation.x;
-      y = widget->allocation.y;
-    }
-  else
+  if (GTK_WIDGET_DRAWABLE (widget))
     {
-      x = 0;
-      y = 0;
+      if (GTK_WIDGET_NO_WINDOW (widget))
+       {
+         x = widget->allocation.x;
+         y = widget->allocation.y;
+         width = widget->allocation.width;
+         height = widget->allocation.height;
+       }
+      else
+       {
+         x = 0;
+         y = 0;
+         gdk_window_get_size (widget->window, &width, &height);
+       }
+      
+      gtk_draw_shadow (widget->style, widget->window,
+                      GTK_STATE_NORMAL, GTK_SHADOW_OUT,
+                      x, y, width, height);
+      
+      gdk_draw_rectangle (widget->window,
+                         widget->style->black_gc,
+                         FALSE,
+                         x, y, width - 1, height - 1);
     }
-       
-  gtk_draw_shadow (widget->style, widget->window,
-                  GTK_STATE_NORMAL, GTK_SHADOW_OUT,
-                  x, y, 
-                  widget->allocation.width,
-                  widget->allocation.height);
-
-  gdk_draw_rectangle (widget->window,
-                     widget->style->black_gc,
-                     FALSE,
-                     x, y,
-                     widget->allocation.width - 1,
-                     widget->allocation.height - 1);
+}
+
+/*************************************************************
+ * gtk_drag_highlight_expose:
+ *     Callback for expose_event for highlighted widgets.
+ *   arguments:
+ *     widget:
+ *     event:
+ *     data:
+ *   results:
+ *************************************************************/
+
+static gboolean
+gtk_drag_highlight_expose (GtkWidget      *widget,
+                          GdkEventExpose *event,
+                          gpointer        data)
+{
+  gtk_drag_highlight_paint (widget);
+  return TRUE;
+}
+
+/*************************************************************
+ * gtk_drag_highlight:
+ *     Highlight the given widget in the default manner.
+ *   arguments:
+ *     widget:
+ *   results:
+ *************************************************************/
+
+void 
+gtk_drag_highlight (GtkWidget  *widget)
+{
+  gtk_signal_connect_after (GTK_OBJECT (widget), "draw",
+                           GTK_SIGNAL_FUNC (gtk_drag_highlight_expose),
+                           NULL);
+  gtk_signal_connect (GTK_OBJECT (widget), "expose_event",
+                     GTK_SIGNAL_FUNC (gtk_drag_highlight_paint),
+                     NULL);
+
+  gtk_widget_queue_draw (widget);
 }
 
 /*************************************************************
@@ -700,25 +748,16 @@ gtk_drag_highlight (GtkWidget  *widget)
 void 
 gtk_drag_unhighlight (GtkWidget  *widget)
 {
-  gint x, y;
-
   g_return_if_fail (widget != NULL);
 
-  if (GTK_WIDGET_NO_WINDOW (widget))
-    {
-      x = widget->allocation.x;
-      y = widget->allocation.y;
-    }
-  else
-    {
-      x = 0;
-      y = 0;
-    }
-       
-  gdk_window_clear_area_e (widget->window,
-                          x, y,
-                          widget->allocation.width,
-                          widget->allocation.height);
+  gtk_signal_disconnect_by_func (GTK_OBJECT (widget),
+                                GTK_SIGNAL_FUNC (gtk_drag_highlight_paint),
+                     NULL);
+  gtk_signal_disconnect_by_func (GTK_OBJECT (widget),
+                                GTK_SIGNAL_FUNC (gtk_drag_highlight_expose),
+                                NULL);
+  
+  gtk_widget_queue_clear (widget);
 }
 
 /*************************************************************
@@ -1097,6 +1136,12 @@ gtk_drag_find_widget (GtkWidget       *widget,
   if (data->found || !GTK_WIDGET_MAPPED (widget))
     return;
 
+  /* Note that in the following code, we only count the
+   * position as being inside a WINDOW widget if it is inside
+   * widget->window; points that are outside of widget->window
+   * but within the allocation are not counted. This is consistent
+   * with the way we highlight drag targets.
+   */
   if (!GTK_WIDGET_NO_WINDOW (widget))
     {
       new_allocation.x = 0;
@@ -1412,7 +1457,7 @@ gtk_drag_dest_drop (GtkWidget          *widget,
       else
        {
          /* We need to synthesize a motion event, wait for a status,
-          * and, if we get one a good one, do a drop.
+          * and, if we get a good one, do a drop.
           */
          
          GdkEvent *current_event;